<?php
    @include_once("conn.php");

    $obj = array();

    $user = $_POST["user"];
    $pwd = $_POST["pwd"];
    $phone = $_POST["phone"];
    $email = $_POST["email"];

    if(!($user&&$pwd&&$phone&&$email)){
        $obj["status"] = false;
        $obj["detail"] = "请输入完整的参数";
        exit(json_encode($obj));
    }

    $sql = "insert into `userinfo`(user,pwd,phone,email) values('$user','$pwd','$phone','$email')";

    $bool = mysqli_query($conn,$sql);

    if(!$bool){
        $obj["status"] = false;
        $obj["detail"] = "该用户已注册是否立即前往登录？";
        $obj["sql"] = $sql;
        exit(json_encode($obj));
    }

    $rows = mysqli_affected_rows($conn);

    if($rows>0){
        $obj["status"] = true;
        $obj["detail"] = "注册成功";
        exit(json_encode($obj));
    }

?>